VERSION = 1.00
CC = gcc
DEBUG = -DUSE_DEBUG
CFLAGS = -Wall -O
SOURCES = $(wildcard ./source/*.c)
INCLUDES = -I./include
#LIB_NAMES = -lfun_a -lfun_so
#LIB_PATH = -L./lib
OBJ = $(patsubst %.c, %.o, $(SOURCES))
TARGET = app

# 链接
$(TARGET): $(OBJ)
	$(CC) $(OBJ) $(LIB_PATH) $(LIB_NAMES) -o output/$(TARGET)$(VERSION)
	rm -rf $(OBJ)

# 编译
%.o: %.c
	$(CC) $(INCLUDES) $(DEBUG) -c $(CFLAGS) $< -o $@

PHONY: clean
clean:
	echo "Remove linked and compiled files......"
	rm -rf $(OBJ) $(TARGET) output
